<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/6
 * Time: 17:09
 */

namespace App\Admin\Tools;


use Encore\Admin\Form\Field;

class UEditor extends Field
{
    protected $view = 'admin.wang-editor';
    // css资源
    protected static $css = [];

    // js资源
    protected static $js = [
        'laravel-u-editor/ueditor.config.js',
        'laravel-u-editor/ueditor.all.min.js',
        'laravel-u-editor/lang/zh-cn/zh-cn.js'
    ];

    public function render()
    {
        $this->script = <<<EOT
        //解决第二次进入加载不出来的问题
        UE.delEditor("{$this->id}");
        // 默认id是ueditor
        var ue = UE.getEditor('{$this->id}');
        

EOT;
        return parent::render();
    }
}